package monitor;

/**
 * Interface definition: Monitor.
 * 
 * @author OpenORB Compiler
 */
@SuppressWarnings("serial")
public class _MonitorStub extends org.omg.CORBA.portable.ObjectImpl
        implements Monitor
{
    static final String[] _ids_list =
    {
        "IDL:monitor/Monitor:1.0"
    };

    public String[] _ids()
    {
     return _ids_list;
    }

    @SuppressWarnings("rawtypes")
	private final static Class _opsClass = monitor.MonitorOperations.class;

    /**
     * Operation ring
     */
    public void ring(String[] prozessIds)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("ring",true);
                    monitor.ProzessIdsHelper.write(_output,prozessIds);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("ring",_opsClass);
                if (_so == null)
                   continue;
                monitor.MonitorOperations _self = (monitor.MonitorOperations) _so.servant;
                try
                {
                    _self.ring( prozessIds);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation startzahlen
     */
    public void startzahlen(int[] startzahlen)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("startzahlen",true);
                    monitor.StartzahlenHelper.write(_output,startzahlen);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("startzahlen",_opsClass);
                if (_so == null)
                   continue;
                monitor.MonitorOperations _self = (monitor.MonitorOperations) _so.servant;
                try
                {
                    _self.startzahlen( startzahlen);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation rechnen
     */
    public void rechnen(String prozessId, String prozessIdAbsender, int num)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("rechnen",true);
                    _output.write_string(prozessId);
                    _output.write_string(prozessIdAbsender);
                    _output.write_long(num);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("rechnen",_opsClass);
                if (_so == null)
                   continue;
                monitor.MonitorOperations _self = (monitor.MonitorOperations) _so.servant;
                try
                {
                    _self.rechnen( prozessId,  prozessIdAbsender,  num);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation terminieren
     */
    public void terminieren(String prozessId, String prozessIdAbsender, boolean terminiere)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("terminieren",true);
                    _output.write_string(prozessId);
                    _output.write_string(prozessIdAbsender);
                    _output.write_boolean(terminiere);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("terminieren",_opsClass);
                if (_so == null)
                   continue;
                monitor.MonitorOperations _self = (monitor.MonitorOperations) _so.servant;
                try
                {
                    _self.terminieren( prozessId,  prozessIdAbsender,  terminiere);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

    /**
     * Operation ergebnis
     */
    public void ergebnis(String prozessId, int num)
    {
        while(true)
        {
            if (!this._is_local())
            {
                org.omg.CORBA.portable.InputStream _input = null;
                try
                {
                    org.omg.CORBA.portable.OutputStream _output = this._request("ergebnis",true);
                    _output.write_string(prozessId);
                    _output.write_long(num);
                    _input = this._invoke(_output);
                    return;
                }
                catch(org.omg.CORBA.portable.RemarshalException _exception)
                {
                    continue;
                }
                catch(org.omg.CORBA.portable.ApplicationException _exception)
                {
                    String _exception_id = _exception.getId();
                    throw new org.omg.CORBA.UNKNOWN("Unexpected User Exception: "+ _exception_id);
                }
                finally
                {
                    this._releaseReply(_input);
                }
            }
            else
            {
                org.omg.CORBA.portable.ServantObject _so = _servant_preinvoke("ergebnis",_opsClass);
                if (_so == null)
                   continue;
                monitor.MonitorOperations _self = (monitor.MonitorOperations) _so.servant;
                try
                {
                    _self.ergebnis( prozessId,  num);
                    return;
                }
                finally
                {
                    _servant_postinvoke(_so);
                }
            }
        }
    }

}
